DevJourney

Python/VIT/sem-1/ex-17/3. Dataframes and Arrays Demo

Dataframes and Arrays Module

Write a simple python code to illustrate the dataframes from pandas (Table with 5 entries of Registration Number, Student Name and Registered Credits) and numpy arrays (Matrix of 3x3 dimension)

Sample output

Enter Student Name: Thomas Shelby
Enter Registered Credits: 18.5
Enter Registration Number: 2
Enter Student Name: Arthur Shelby
Enter Registered Credits: 18 
Enter Registration Number: 3
Enter Student Name: Polly Gray
Enter Registered Credits: 18
Enter Registration Number: 4
Enter Student Name: John Shelby
Enter Registered Credits: 17
Enter Registration Number: 5         
Enter Student Name: Ada Shelby 
Enter Registered Credits: 17.5
Pandas DataFrame:
   Registration Number   Student Name  Registered Credits
0                   1  Thomas Shelby                18.5
1                   2  Arthur Shelby                18.0
2                   3     Polly Gray                18.0
3                   4    John Shelby                17.0
4                   5     Ada Shelby                17.5
Enter the value for element (1, 1): 13
Enter the value for element (1, 2): 54
Enter the value for element (1, 3): 23
Enter the value for element (2, 1): 67
Enter the value for element (2, 2): 34
Enter the value for element (2, 3): 78
Enter the value for element (3, 1): 3
Enter the value for element (3, 2): 2
Enter the value for element (3, 3): 45

Numpy Array (Matrix):
 [[13 54 23]
 [67 34 78]
 [ 3  2 45]]

Contents:

View on GitHub